<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<link href="/static/resources/bootstrap/css/bootstrap.css" rel="stylesheet">
<link href="/static/resources/font-awesome/css/font-awesome.min.css" rel="stylesheet">
<link href="/static/resources/css/style.css" rel="stylesheet">
<link href="/static/resources/css/exam.css" rel="stylesheet">
<script type="text/javascript" src="/static/resources/exportExcel/external/jquery-1.8.2.js"></script>
<script type="text/javascript" src="/static/resources/vue/vue.js"></script>
<script type="text/javascript" src="/static/resources/vue/date.js"></script>
<script type="text/javascript" src="/static/resources/js/all.js"></script>
<script type="text/javascript" src="/static/resources/js/tag-list.js"></script>
<script type="text/javascript" src="/static/resources/js/add-tag.js"></script>
<script type="text/javascript" src="/static/resources/js/add-tag.js"></script>
<script type="text/javascript" src="/static/resources/laypage/laypage.js" charset="utf-8"></script>
<script type="text/javascript" src="/static/resources/layui/layui.all.js" charset="utf-8"></script>
<body>

<div id="app">
    <div class="container">
        <div class="row">
            <div class="col-md-3" style="padding:2em 0;">
                <button type="button" class="btn btn-success btn-block" id="generate-excel"><i class="fa fa-file-excel-o" aria-hidden="true"></i> 将表格转换为Excel</button>
            </div>
            <div class="col-md-12" style="padding:2em 0;">
                <div class="table-responsive">
                    <table class="table table-bordered table-striped" id="test_table">
                        <thead>
                        <tr>
                            <td>序号</td>
                            <td>学生姓名</td>
                            <td>所属班级</td>
                            <td>考试名称</td>
                            <td>考试时间</td>
                            <td>考试分数</td>
                            <td>试卷分数</td>
                        </tr>
                        </thead>
                        <tbody>
                        <tr  v-for="(item,index) in userExamInfoResult">
                            <td><span>{{index+1}}</span></td>
                            <td><span>{{item.true_name}}</span></td>
                            <td><span>{{item.dep_name}}</span></td>
                            <td><span>{{item.exam_name}}</span></td>
                            <td><span>{{item.create_time | DateFilter}}</span></td>
                            <td><span>{{item.point}}</span></td>
                            <td><span>{{item.totalpoint}}</span></td>
                        </tr>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
</html>

<script type="text/javascript" src="/static/resources/exportExcel/external/jszip.js"></script>
<script type="text/javascript" src="/static/resources/exportExcel/external/FileSaver.js"></script>
<script type="text/javascript" src="/static/resources/exportExcel/scripts/excel-gen.js"></script>
<script type="text/javascript" src="/static/resources/exportExcel/scripts/demo.page.js"></script>
<script type="text/javascript">
    Vue.filter("DateFilter", function (date) {
        var v = new Date(date);
        return formatDate(v, "yyyy-MM-dd HH:mm:ss");
    });


    var app = new Vue({
        el: '#app',
        data: {
            result: [],
            userExamInfoResult:[]
        }
    });

    $(function () {
        getUserExamInfo();
    });

    function getUserExamInfo(curr){
        $.ajax({
            type:'post',
            url:'/getUserExamInfo',
            data:{
                pageSize: 1000,
                pageNum: curr ||1,
                examId: ${examId}
            },
            dataType:'json',
            success:function (msg) {
                app.userExamInfoResult = msg.page;
                laypage({
                    cont: 'pagenav5', //分页容器
                    pages: msg.totalPage,//总页数
                    skin: "#333333",
                    first: "首页",
                    last: "尾页",
                    curr: curr || 1,
                    jump: function (obj, first) {
                        if (!first) {
                            getUserExamInfo(obj.curr);
                        }
                    }
                })
            },
            error:function () {
               // alert("列表有误");
            }
        })
    }
</script>